<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
	response.setHeader("Pragma","No-cache");
	response.setHeader("Cache-Control","no-cache");
	response.setDateHeader("Expires", 0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="keywords" content="短信监控" />
		<meta http-equiv="description" content="10086主动群发短信监控系统" />
		<title>AFC设备维修系统用户登录</title>
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/index.css" />
		<style type="text/css">
		* {
			margin:0;
			padding:0;
		}
				
		.tt{
			background-repeat:no-repeat;
			border-left-style:none;
			border-right-style:none;
			border-bottom-style:none;
			border-top-style:none;
			background-color: transparent;
		}
		</style>
		<script src="js/jquery-1.7.2.js"></script>
		<script type="text/javascript" language="javascript">
			//回退至index
			window.history.forward(1);
			
		</script>  
		<script type="text/javascript">
		
		function getnums(){
			var inputUsername = $("#inputUsername").val() + "";
			var inputPassword = $("#inputPassword").val() + "";
			if(inputUsername != ""){
				$("#inputUsername").parent().css("background-image","url(images/10086/click_text.gif)");
			}
			if(inputPassword != ""){
				$("#inputPassword").parent().css("background-image","url(images/10086/click_text.gif)");
			}
		}
		
		$(document).ready (function() {
			setInterval(getnums, 50);
				
			$("#inputUsername").focus(function(){
				$(this).parent().css("background-image","url(images/10086/click_text.gif)");
			});
			
			$("#inputUsername").blur(function(){
				if(null == $(this).val() || $(this).val()==''){
					$(this).parent().css("background-image", "url(images/10086/username_unselect.gif)");
				}
			});
			
			$("#inputPassword").focus(function(){
				$(this).parent().css("background-image","url(images/10086/click_text.gif)");
			});
			
			$("#inputPassword").blur(function(){		
				if(null == $(this).val() || $(this).val()==''){
					$(this).parent().css("background-image", "url(images/10086/pwd_no.gif)");
				}	
			});
			
			$("#loginB").click(function(){
				if(checkLogin()){
					document.loginFrm.submit();
				}	
				var cssName = $(this).attr("style");
				$(this).css("background-image","url(images/10086/login_click.gif)");
				
				$(this).blur(function(){
					$(this).css("background-image","url(images/10086/login_no.gif)");
				});
			});
			
			$("#cannel").click(function(){
				$("#inputUsername").val('');
				$("#inputPassword").val('');
				//修改按钮背景样式
				var cssName = $(this).attr("style");
				//修改文本框背景样式
				$("#inputUsername").parent().css("background-image","url(images/10086/username_unselect.gif)");
				$("#inputPassword").parent().css("background-image","url(images/10086/pwd_no.gif)");
				
				$(this).css({'background-image':'url(images/10086/onclick.gif)'});
				$(this).blur(function(){
					$(this).css({'background-image':'url(images/10086/noselect.gif)'});
				});
			});
			
			
			//取消回车事件
			 $("#cannel").keydown(function(event){         
				 if(event.keyCode == 13){
				 	document.getElementById("cannel").click();
				}
			 });
			 //密码框回车事件
			 $("#inputPassword").keydown(function(event){    
				 if(event.keyCode == 13){
					 document.getElementById("loginB").click();
				}
			 });
		});
		
	function trim(str) 
		{
		str = str.replace( /^\s*/, "");
		str = str.replace( /\s*$/, "");
		str = str.replace( /^[" "|"　"]*/, "");
		str = str.replace( /[" "|"　"]*$/, ""); 
		return str;
	}
	
	function checkLogin(){
		var codeReg = /^[0-9a-zA-Z_]{1,}$/;
		var pwd = $("#inputPassword").val();
		var code = $("#inputUsername").val();
		if(null == code || trim(code)==''){
			$('#msg').html('请输入用户账号！');
			$('#inputUsername').focus();
			return false;
		}
		if(getLen(code)>30)
		{
			$('#msg').html("用户账号字符个数不能大于30！");
			$('#inputUsername').focus();
			return false;
		}
		//特殊字符校验
		if (!codeReg.test(code)) 
		{
			$('#msg').html("用户账号仅可包含字母、数字、下划线，请重新输入！");
			$('#inputUsername').focus();
			return false;
		}
		if(null == pwd || trim(pwd)==''){
			$('#msg').html('请输入登录密码！');
			$('#inputPassword').focus();
			return false;
		}
		if(trim(pwd).length>20 ||trim(pwd).length<6){
			$('#msg').html('请输入6-20位字符的用户密码');
			$('#inputPassword').focus();
			return false;
		}
		return true;
	}
	
	function init(){//用户名获得焦点
			document.getElementById("inputUsername").focus();
		}
		window.onload=init;
		
	/**计算字符串长度  中文三个字符计算**/
	function getLen(str){
	   var len=0;
	   if(null!=str&&str!=""){
	   for(var i=0;i<str.length;i++){
	   var intCode=str.charCodeAt(i);
	   //如果ASCII码等于34(")38(&)39(')47(/)60(<)62(>)92(\)也算三个字符
	   if (intCode>=0&&intCode<=127&&intCode!=34&&intCode!=39&&intCode!=47&&intCode!=60&&intCode!=62&&intCode!=92){
	        len=len+1;
	      }else{
	         len=len+3;
	            }
	       }
	    }
	   return len;
	}
</script>
 

	</head>

	<body style="background-color:#e5e5e5; min-width:1400px; height:580px;"  oncontextmenu="return false" ondragstart="return false" 
	onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" 
	onbeforecopy="return false" nmouseup="document.selection.empty()" >
<form action="login.action" method="post" id="loginFrm"  name="loginFrm">
	<div style="background:url(images/10086/bottom_login.gif); width:1400px; height:550px; margin:0 auto; overflow:hidden;">
	  <div id="msg" style="font-size: 16px; position:relative; padding-left:740px; top:200px; font-family: '\5FAE\8F6F\96C5\9ED1'; color:red; margin: 0 auto;">${message } </div>
	  <div style="background:url(images/10086/login_22.gif); width:960px; height:137px; margin:211px auto;padding-top:90px;" >
	    <table style="margin-left:540px;">
          <tr>
            <td style=" line-height:37px; vertical-align:middle; width:186px; height:38px; background:url(images/10086/username_unselect.gif) no-repeat;padding: 0 0 0 5px;">
            	<input name="loginUser.userCode" value="" type="text" class="tt" id="inputUsername" type="text" style="font-size:18px; font-family: '\5FAE\8F6F\96C5\9ED1'; color:#999999; width: 175px; height: 38px; line-height: 38px; outline: none;" />
            </td>
            <td style="width:186px; height:38px; background:url(images/10086/pwd_no.gif) no-repeat;">
            	<input name="loginUser.password" value="" id="inputPassword" type="password" class="tt"  style="font-size:18px; padding-left:5px; color:#999999; line-height:37px; width:175px; height: 38px; line-height: 38px; outline: none;" />
            </td>
          </tr>
          <tr>
            <td></td>
            <td align="right" style="line-height:80px;" ><input name="button" type="button" class="tt" id="loginB" style="width:73px; height:35px;background-image:url(images/10086/login_no.gif);cursor: pointer;" />
                <input name="button" type="button" class="tt" id="cannel" style="width:73px; height:35px; background-image:url(images/10086/noselect.gif);cursor: pointer;" />
            </td>
          </tr>
        </table>
        </div>
	</div>
<div id="bottom" style="">
	<div class="body">
		<label >版权所有&nbsp;&nbsp;&nbsp;&nbsp;2012南京熊猫信息产业有限公司</label>
	</div>
</div>
</form>
</body>
</html>
